package sky.com.util
{
	import classes.CommandTransfer;
	
	import mx.controls.Alert;

	public class CommandTransferFactory
	{
		
		private static var commandTransferInstance:CommandTransfer;
		
		public function CommandTransferFactory()
		{
		}
		
		public static function createCommandTransferInstance(recvCmd:Function,ip:String,port:int):void{
			commandTransferInstance=new CommandTransfer(recvCmd);
			var ret:int = commandTransferInstance.connectToServer(ip, port);
//			if (0 == ret)
//			{
//				Alert.show("连接服务器成功");
//			}
//			else
//			{
//				Alert.show("连接服务器失败");
//			}
		}
		
		public static function getCommandTransferInstance():CommandTransfer{
			return commandTransferInstance;
		}
		
		public static function closeConnect():void{
			commandTransferInstance.close();
		}
		
		
	}
}